<template>
	<view class="Contbox">
		<topItem :labels="labels" :phone=phone :infor="company" :job="job"  />
		<base1Simple :job="job" :phone=phone :infor="company" :workTypeList="workTypeList" />
		<base4 :job="job" :infor="company" :img="imgs" />
		<footers :job="job" :jobId="jobId" :simple1="simple1"/>
	</view>
</template>

<script>
	import Bus from '../../../../utils/bus.js'
	import topItem from "./item/top1.vue";
	import base1Simple from "./item/base1Simple.vue";
	import base2 from "./item/base2.vue";
	import base3 from "./item/base3.vue";
	import base4 from "./item/simple.vue";
	import footers from "./item/footer.vue"
	import api from '../../../../api/routes.js'
		import {
		mapMutations
	} from 'vuex'
	export default {
		components: {
			topItem,
      base1Simple,
			base2,
			base3,
			base4,
			footers
		},
		name: "detail",
		data() {
			return {
				jobId: '',
				company: {},
				job: {},
				phone:'',
				imgs: [],
				labels: [],
        workTypeList:[],
		simple1:''

			};
		},
		onLoad(e) {
			this.simple1=e.simple
			console.log(e.simple,"0或1");
			console.log(e.jobId);
			this.jobId = e.jobId;
			this.getList();
			this.setSearchPage(1);
			this.setsiteRecruitmentPage(1);
			
			
		},
		methods: {
			// bus传值
			// toBPage(){
			// 		Bus.$emit('simpledetail组件传值',this.job)
			// 	},
				...mapMutations(["setSearchPage",'setsiteRecruitmentPage']),
			async getList() {
				const res = await this.$myRequest({
					// url: "/app/job/jobDetail",
					url: api.jobDetail,
					method: "GET",
					data: {
						jobId: this.jobId
					},
				});
				console.log(res.data.workTypeList,"岗位详情页？555");
				console.log(res.data,"岗位详情页？666");
				if (res.data.code == 0) {
					this.company = res.data.company
					this.job = res.data.job
					console.log(this.job,'this.job');
					// 手机号影藏
					var phone = this.job.publishTell;
					this.phone=phone.replace(/^(\d{3})\d+(\d{4})$/, "$1****$2");
					
					this.workTypeList = res.data.workTypeList
					// this.imgs =res.data.company.descImgUrls? res.data.company.descImgUrls.split(','):[]
					this.imgs =res.data.job.imgUrls? res.data.job.imgUrls.split(','):[]
					this.labels = res.data.job.labels.split(',')
				}
			},
		}
	};
</script>
<style lang="scss" scoped>
	.Contbox {
		padding: 0 0 60px 0;
	}
</style>
